This repository has no description
1<script lang="ts">
2 // the @ resets out of the profile shell, repo pages want their own header and
3 // tabs instead of the profile card
4 import { page } from "$app/state";
5 import RepoHeader from "$lib/components/repo/RepoHeader.svelte";
6 import RepoTabs from "$lib/components/repo/RepoTabs.svelte";
7
8 let { children, data } = $props();
9
10 const fullName = $derived(`${data.repo.ownerHandle}/${data.repo.name}`);
11 const repoUrl = $derived(`${page.url.origin}/${fullName}`);
12 const fullNameWithoutAt = $derived(fullName.replace(/^@/, ""));
13
14 const activeTab = $derived.by(() => {
15 const segment = page.route.id?.split("/")[3] ?? "";
16 return ["issues", "pulls", "pipelines", "settings"].includes(segment) ? segment : "overview";
17 });
18
19 // the pull page runs a discussion rail down the full page height, so it places
20 // the repo header and tabs inside its own column instead of taking them here
21 const bare = $derived(page.route.id === "/[handle]/[repo]/pulls/[aturi]");
22
23 // commit and pull pages break out of the reading column, everything else
24 // stays capped
25 const fullWidth = $derived(bare || (page.route.id ?? "").includes("/commit/"));
26</script>
27
28<!-- todo: og and twitter card tags, the appview has repo/fragments/og.html -->
29<svelte:head>
30 <title>{fullName} · Tangled</title>
31 <meta name="description" content={data.repo.description ?? "A repository on Tangled"} />
32 <meta name="vcs:clone" content={repoUrl} />
33 <meta name="forge:summary" content={repoUrl} />
34 <meta name="forge:dir" content={`${repoUrl}/tree/{ref}/{path}`} />
35 <meta name="forge:file" content={`${repoUrl}/blob/{ref}/{path}`} />
36 <meta name="forge:line" content={`${repoUrl}/blob/{ref}/{path}#L{line}`} />
37 <meta
38 name="go-import"
39 content={`tangled.sh/${fullNameWithoutAt} git https://tangled.sh/${fullName}`}
40 />
41 <meta
42 name="go-import"
43 content={`tangled.org/${fullNameWithoutAt} git https://tangled.org/${fullName}`}
44 />
45</svelte:head>
46
47<section class={fullWidth ? "w-full px-2 py-6 sm:px-4" : "mx-auto w-full max-w-screen-lg py-6"}>
48 {#if !bare}
49 <RepoHeader repo={data.repo} counts={data.counts} viewerStarRkey={data.viewerStarRkey} />
50 <RepoTabs repo={data.repo} counts={data.counts} active={activeTab} />
51 {/if}
52 {@render children()}
53</section>